//
//  WEXEmoticonModel.swift
//  microBlog
//
//  Created by apple on 16/4/27.
//  Copyright © 2016年 Hill. All rights reserved.
//

import UIKit

class WEXEmoticonModel: NSObject,NSCoding {
    
    //    标识表情字符串
    var chs: String?
    
    var gif: String?
    
    //    emoji表情的字符串
    var code: String?
    //    图片表情对应的图片技巧
    var png: String?
    //    判断是否是emoji表情
    var type: String?
    //    文件夹的名字
    var folderName: String?
    
    init(dict: [String: AnyObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
    }
    
    
    //    解档
    required init?(coder decoder: NSCoder) {
        chs = decoder.decodeObjectForKey("chs") as? String
        code = decoder.decodeObjectForKey("code") as? String
        type = decoder.decodeObjectForKey("type") as? String
        png = decoder.decodeObjectForKey("png") as? String
        folderName = decoder.decodeObjectForKey("folderName") as? String
    }
    
    //    归档
    func encodeWithCoder(encoder: NSCoder) {
        
        encoder.encodeObject(chs, forKey: "chs")
        encoder.encodeObject(code, forKey: "code")
        encoder.encodeObject(type, forKey: "type")
        encoder.encodeObject(png, forKey: "png")
        encoder.encodeObject(folderName, forKey: "folderName")
    }
    
    override var description: String{
        
        let keys = ["chs","code","type"]
        
        return dictionaryWithValuesForKeys(keys).description
        
    }
    
}

